package sdk

import (
	app "gddgame.cc/galaxy/core/controllers/app"
	"gddgame.cc/galaxy/core/models"
)

type ServicePlatform interface {
	ParseAccessToken(appAppId string, appToken string, token string) (*models.App, string, map[string]interface{}, error)
}

type servicePlatform struct {
	client *ServiceClient
}

func newServerPlatform(client *ServiceClient) (*servicePlatform, error) {
	platform := &servicePlatform{
		client: client,
	}
	if err := app.InitApp(platform.client, platform.client); err != nil {
		return nil, err
	}
	return platform, nil
}

func (platform *servicePlatform) ParseAccessToken(appAppId string, appToken string, accessToken string) (*models.App, string, map[string]interface{}, error) {
	return app.ParseAccessToken(platform.client, appAppId, appToken, accessToken)
}
